<template>
  <div class="common-layout">
    <el-container>
      <el-aside width="auto">
        <Logo :logoStatus="logoStatus" @change="changeLogo" />
        <Menu :collapse="logoStatus" />
      </el-aside>
      <el-container>
        <el-header height="60px">
          <HeaderBar />
        </el-header>
        <el-main>
          <router-view v-slot="{ Component }">
            <component :is="Component" />
          </router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script setup>
import { ref, getCurrentInstance } from 'vue';

const { proxy } = getCurrentInstance()

const logoStatus = ref(false)

const changeLogo = (status) => {
  logoStatus.value = status
}

const changemessage = () => {
  ElMessage('this is a message.')
}
</script>

<style lang="scss" scoped>
.common-layout {
  height: 100vh;

  .el-container {
    height: 100%;
  }

  .el-header,
  .el-main,
  .el-aside {
    display: flex;
  }

  .el-header {
    align-items: center;
    justify-content: flex-end;
    background-color: var(--el-color-primary-light-7);
    color: var(--el-text-color-primary);
    text-align: center;
  }

  .el-aside {
    flex-direction: column;
    align-items: center;
    background-color: var(--el-color-primary-light-8);
    color: var(--el-text-color-primary);
    text-align: center;
    // overflow: hidden;
  }

  .el-main {
    height: calc(100% - 60px);
    background-color: var(--el-color-primary-light-9);
    color: var(--el-text-color-primary);
    text-align: center;
  }
}
</style>